import { fetch } from "./fetch";

// 首页轮播图数据
export const ApiHome = () => fetch("/index/banners/travel");

// 游记列表     /travels/query
export const ApiQuery = (params) =>
  fetch(`/travels/query?orderType=${params}`, {}, "GET", {});

//   登录
export const ApiLogin = (params) =>
  fetch(
    `/users/login?username=${params.username}&password=${params.password}`,
    params,
    "POST"
  );

// 注册
export const ApiRegister = (params) =>
  fetch(
    `/users/regist?phone=${params.phone}&nickname=${params.nickname}&password=${params.password}&rpassword=${params.rpassword}&verifyCode=${params.verifyCode}`,
    {},
    "POST"
  );

// 获取验证码
export const ApiCode = (params) =>
  fetch(`/users/sendVerifyCode?phone=${params.phone}`, {}, "POST");

//   检查手机号是否注册

export const ApiCheckPhone = (phone) =>
  fetch(`/users/checkPhone?phone=${phone}`);

// 获取当前登录用户信息
export const ApiUser = () => fetch("/users/currentUser");
